<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>属性选择器CSS3</title>
    <style>
        /* 字符匹配  字母 abc
        [foo^=abc]  开始
        [foo$=abc]  末尾
        [foo*=abc]  都可以
        */
        /* [foo^=abc] {
            background-color: red;
        } */

        /* [foo$=abc] {
            background-color: red;
        } */

        [foo*=abc] {
            background-color: red;
        }

        /* @font-face =>  url  CSS3 属性选择器*/
        [class^="icon"],
        [class*="icon"] {
            display: block;
            width: 20px;
            height: 20px;
            margin: 20px;
            background: rebeccapurple;
        }

        [class*=iconfont] {
            font-family: iconfont !important;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -webkit-text-stroke-width: .2px;
            -moz-osx-font-smoothing: grayscale
        }
    </style>
</head>

<body>
    <ul>
        <li foo>1</li>
        <li foo="abc">2</li>
        <li foo="abc efj">3</li>
        <li foo="abcefj">4</li>
        <li foo="efjabc">5</li>
        <li foo="ab">6</li>
    </ul>

    <i class="cart"></i>
    <i class="home"></i>
    <i class="search"></i>

    <i class="icon-cart"></i>
    <i class="icon-home"></i>
    <i class="icon-search"></i>
    <i class="search-icon"></i>
</body>

</html>